package com.redis.springbootredis.config.myredis;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
import redis.clients.jedis.JedisSentinelPool;

import java.util.HashSet;
import java.util.Set;

/**
 * xufan
 * 2019/1/1
 */
public class Test {



    public static void main(String[] args) {
        JedisPoolConfig config = new JedisPoolConfig();
//        config.config
//        JedisPool pool = new JedisPool(config,"127.0.0.1",6379);
//        Jedis jedis = pool.getResource();
//        String a = jedis.get("xufan");
//        System.out.println(a);

        Set<String> sentinels = new HashSet<>();
        sentinels.add("127.0.0.1:26379");
        JedisSentinelPool pool= new JedisSentinelPool("mymaster",sentinels,config);
        Jedis jedis =  pool.getResource();
        String a = jedis.get("xufan");
        System.out.println(a);
        pool.returnResource(jedis);

    }

}
